//
//  ExpressionUtils.m
//  Expressions
//
//  Created by admin on 3/11/13.
//  Copyright (c) 2013 admin. All rights reserved.
//

#import "ExpressionUtils.h"

@implementation ExpressionUtils
+(BOOL) isLandscapse {
    UIInterfaceOrientation orien = [UIApplication sharedApplication].statusBarOrientation;
    if (UIInterfaceOrientationIsLandscape(orien)) {
        return YES;
    }
    return NO;
}
+(CGSize) getSizeIpad{
    UIInterfaceOrientation orien = [UIApplication sharedApplication].statusBarOrientation;
    CGSize size = CGSizeZero;
    if (UIInterfaceOrientationIsLandscape(orien)) {
        size = CGSizeMake(1024, 748);
    }else {
        size = CGSizeMake(768, 1004);
    }
    return size;
}
+(CGSize) getSizeIphone
{
    UIInterfaceOrientation orien = [UIApplication sharedApplication].statusBarOrientation;
    CGSize size = CGSizeZero;
    if (UIInterfaceOrientationIsLandscape(orien)) {
        size = CGSizeMake(480, 300);
    }else {
        size = CGSizeMake(320, 460);
    }
    return size;
}
+(CGSize)getSizeDevice
{
    if ([self isIpadDevice]) {
        return [self getSizeIpad];
    }else {
        return [self getSizeIphone];
    }
}
+(BOOL)isIpadDevice
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return NO;
    }else {
        return YES;
    }
}
+(UIImage *)resizeImage:(UIImage *)image destinationSize:(CGSize)destionationSize
{
    UIGraphicsBeginImageContext(destionationSize);
    [image drawInRect:CGRectMake(0, 0, destionationSize.width, destionationSize.height)];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return  newImage ;
}
@end
